/*
 ------------------------------------------------------------------------------
 Copyright (C) 2013 Eternal Games.

 This file is part of the EternalTech source code.

 The EternalTech source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The EternalTech source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the EternalTech source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


//
// cm_public.h - public header to all other files
//


#ifndef __CM_PUBLIC_H__
#define __CM_PUBLIC_H__


// Loads and prepares the given map for collision detection
void			CM_LoadMap (const char *name);

// Frees the current map and all the models
void			CM_FreeMap ();

// Loads and registers the given model
clipModel_t *	CM_RegisterModel (const char *name);

// Gets the bounds of the given model
void			CM_GetModelBounds (clipModel_t *model, glqBounds &bounds);

// Sets up a box model for collision detection
clipModel_t *	CM_SetupBoxModel (int contents, const glqBounds &bounds);

// Returns the entity string for the given map
char *			CM_EntityString ();

// Performs a point (bounds == 0) or box (bounds != 0) trace through the map or
// a model.
// A trace with start == end will actually perform a position test.
void			CM_Trace (const glqVec3 &start, const glqVec3 &end, const glqBounds &bounds, int contentMask, clipModel_t *model, const glqVec3 &modelOrigin, const glqMat3 &modelAxis, trace_t *trace);

//
byte *CM_LeafPVS (clipLeaf_t *leaf);

//
bool CM_PointInLeaf (const glqVec3 &point, int *nodeNum);

// Initializes the collision subsystem
void			CM_Init ();

// Shuts down the collision subsystem
void			CM_Shutdown ();


#endif	// __CM_PUBLIC_H__